package cn.renxuan.service.weather.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import cn.renxuan.entity.FS_DomesticWeather;
import cn.renxuan.service.weather.json.LunDearBase;
import cn.renxuan.service.weather.json.LunDearWeather;

@Mapper
public interface LunDearWeatherMapper {
    LunDearWeatherMapper INSTANCE = Mappers.getMapper(LunDearWeatherMapper.class);

    /*
     * * 将LunDearWeather转换为FS_DomesticWeather lundearWeather.
     */
    // @Mapping(source = "data.cityInfo.cityCn", target = "city")
    // @Mapping(source = "data.cityInfo.provCn", target = "province")
    // @Mapping(source = "data.cityInfo.areaCn", target = "county")

    @Mapping(source = "data.cityInfo.areaCode", target = "countycode")
    @Mapping(source = "data.now.WD", target = "winddirection")
    @Mapping(source = "data.now.WS", target = "windpower")
    @Mapping(source = "data.now.weather", target = "weather")
    @Mapping(source = "data.now.temp", target = "temperature")
    @Mapping(source = "data.now.SD", target = "humidity")
    @Mapping(source = "data.now.njd", target = "njd")
    @Mapping(source = "data.now.qy", target = "qy")
    @Mapping(source = "data.now.rain", target = "rain1h")
    @Mapping(source = "data.now.rain24h", target = "rain24h")
    FS_DomesticWeather toDomesticWeather(LunDearBase<LunDearWeather> lundearWeather);
}
